<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="${aier_content_type}" />
<meta name="keywords" content="${aier_keyworks}" />
<meta name="description" content="${aier_description}" />
<link href="${aier_css_url}jc/chosen.css" rel="stylesheet">
<link href="${aier_css_url}jq/jq.css" rel="Stylesheet" />
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="stylesheet" href="${aier_css_url}comm/text.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet" href="${aier_css_url}comm/fb.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/hh/ui.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/arrayList.js"></script>
<script type="text/javascript" src="${aier_js_url}jc/cj.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/jq.js"></script>
<script type="text/javascript" src="${aier_js_url}jq/cn.js"></script>
<script type="text/javascript" src="${aier_js_url}comm/text.js"></script>
<title>意见反馈详情</title>
</head>

<body style="background-color: #EEF2FB;">

	<div style="background-color: #EEF2FB;width: 100%;height: 700px; ">

		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">意见反馈详情</a>
				</li>
			</ul>
			<div id="tabs-1" style="height: 500px;">
				<div class="d_content">
					<div class="d_return">
						<button id="b_return"
							class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
							role="button" aria-disabled="false">
							<span class="ui-button-text">返回</span>
						</button>
					</div>

					<div class="d_scnOut" style="margin-top: 10px;">
						<div class="d_scname">
							<label>标题:</label>
						</div>
						<div class="d_sctext" style="*margin-left: 120px;">
							${feedback.title}</div>
					</div>
					<div style="margin-top: -40px;margin-left: 400px;">
						<div class="d_scnOut">
							<div class="d_scname">
								<label>提议时间:</label>
							</div>
							<div class="d_sctext" id="dateDiv" style="*margin-left: 120px;">

							</div>
						</div>

					</div>
					<div class="testDiv">
						<div class="d_scname">
							<label>${realname}:</label>
						</div>
						<div class="d_sctext_left"
							style="*margin-left: 120px;*margin-top: -20px;">
							${feedback.content}</div>

						<div id="content"></div>
					</div>
					<div class="d_scname">
						<label>回复:</label>
					</div>
					<div style="margin-left: 120px;margin-top: -20px;">
						<textarea rows="5" cols="60" id="feedContent"></textarea>
					</div>
					<button id="b_siFeedback"
						class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
						role="button" aria-disabled="false"
						style="margin-left: 508px;*margin-left: 500px; margin-top: 0px;">
						<span class="ui-button-text">发送</span>
					</button>
				</div>
			</div>
		</div>

	</div>
</body>
<script type="text/javascript">
	$("#tabs").tabs();
	$('#b_return').click(function() {
		location.href = "${aier_url}zxadmin/customer${aier_suffix}";
	});

	$('#b_siFeedback')
			.click(
					function() {
						var content = $("#feedContent");
						var contentVal = content.val();
						if (isnull(contentVal) || contentVal.length > 200) {
							content.addClass("ui-state-error");
							$().message("回复内容为1-200个字符!");
							content.focus();
							return;
						} else {
							content.removeClass("ui-state-error");
						}
						var fun = function(data) {
							if (1 == data.s) {
								content.val("");
								content.focus();
								$().message("回复成功,您可以继续回复!");
								contentLoad();
							} else {
								$().message("回复失败,请稍后再试!");
							}
						};
						exeAjax(
								ajaxUrl("${aier_url}${aier_urijs}/customermanage_commitFeedback${aier_suffix}"),
								fun, {
									"fbid" : "${fbid}",
									"content" : contentVal,
									"state" : "${feedback.state}",
									"mid" : "${mid}"
								});
					});

	contentLoad();
	function contentLoad() {
		var cdate = "${feedback.cdate}";
		if (!isnull(cdate)) {
			$("#dateDiv").html(cdate.split(".")[0]);
		}
		$(document)
				.ready(
						function() {
							var fun = function(data) {
								$("#content").html("");
								for ( var i = 0; i < data.contentList.length; i++) {
									if (data.contentList[i].uid == "${feedback.uid}") {
									   var name = data.contentList[i].name;
					                    if (isnull(name)) {
					                        name = data.contentList[i].account;
					                    }
										var html = "<div style='margin-top: 10px;'><div class='d_scname'><label>"
												+ name
												+ ":</label></div><div class='d_sctext_left'>"
												+ data.contentList[i].content
												+ "</div></div>";
										$("#content").append(html);
									} else {
										var adminName = data.contentList[i].name;
										if (isnull(adminName)) {
											adminName = "管理员";
										}
										var html = "<div style='margin-left:400px;margin-top: 10px;'><div class='d_scname'><label>"
												+ adminName
												+ ":</label></div><div class='d_sctext_right' style='*margin-left: 120px;*margin-top: -20px;'>"
												+ data.contentList[i].content
												+ "</div></div>";
										$("#content").append(html);
									}
								}

							};
							// 查询意见及反馈列表
							exeAjax(
									ajaxUrl("${aier_url}${aier_urijs}/customermanage_queryFeedbackContent${aier_suffix}"),
									fun, {
										fbid : "${fbid}"
									});
						});
	}
</script>
</html>